{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from mpl_toolkits.mplot3d import Axes3D\n",
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "df = pd.read_csv(\"http.csv\", low_memory=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Data Quality Report\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Data Type</th>\n",
       "      <th>Count</th>\n",
       "      <th>Unique Values</th>\n",
       "      <th>Missing Values</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>ts</th>\n",
       "      <td>float64</td>\n",
       "      <td>159346</td>\n",
       "      <td>159336</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>uid</th>\n",
       "      <td>object</td>\n",
       "      <td>159346</td>\n",
       "      <td>67478</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>id.orig_h</th>\n",
       "      <td>object</td>\n",
       "      <td>159346</td>\n",
       "      <td>128</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>id.orig_p</th>\n",
       "      <td>int64</td>\n",
       "      <td>159346</td>\n",
       "      <td>1079</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>id.resp_h</th>\n",
       "      <td>object</td>\n",
       "      <td>159346</td>\n",
       "      <td>11820</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>id.resp_p</th>\n",
       "      <td>int64</td>\n",
       "      <td>159346</td>\n",
       "      <td>65</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>trans_depth</th>\n",
       "      <td>int64</td>\n",
       "      <td>159346</td>\n",
       "      <td>186</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>method</th>\n",
       "      <td>object</td>\n",
       "      <td>159277</td>\n",
       "      <td>6</td>\n",
       "      <td>69</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>host</th>\n",
       "      <td>object</td>\n",
       "      <td>157769</td>\n",
       "      <td>10969</td>\n",
       "      <td>1577</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>uri</th>\n",
       "      <td>object</td>\n",
       "      <td>159277</td>\n",
       "      <td>91578</td>\n",
       "      <td>69</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>referrer</th>\n",
       "      <td>object</td>\n",
       "      <td>128257</td>\n",
       "      <td>9908</td>\n",
       "      <td>31089</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>user_agent</th>\n",
       "      <td>object</td>\n",
       "      <td>158088</td>\n",
       "      <td>410</td>\n",
       "      <td>1258</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>request_body_len</th>\n",
       "      <td>int64</td>\n",
       "      <td>159346</td>\n",
       "      <td>417</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>response_body_len</th>\n",
       "      <td>int64</td>\n",
       "      <td>159346</td>\n",
       "      <td>31314</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>status_code</th>\n",
       "      <td>float64</td>\n",
       "      <td>157452</td>\n",
       "      <td>26</td>\n",
       "      <td>1894</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>status_msg</th>\n",
       "      <td>object</td>\n",
       "      <td>157452</td>\n",
       "      <td>65</td>\n",
       "      <td>1894</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>info_code</th>\n",
       "      <td>float64</td>\n",
       "      <td>15</td>\n",
       "      <td>1</td>\n",
       "      <td>159331</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>info_msg</th>\n",
       "      <td>object</td>\n",
       "      <td>15</td>\n",
       "      <td>1</td>\n",
       "      <td>159331</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>filename</th>\n",
       "      <td>float64</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>159346</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>tags</th>\n",
       "      <td>object</td>\n",
       "      <td>159346</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>username</th>\n",
       "      <td>object</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>159344</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>password</th>\n",
       "      <td>float64</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>159346</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>proxied</th>\n",
       "      <td>object</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>159343</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>orig_fuids</th>\n",
       "      <td>object</td>\n",
       "      <td>2448</td>\n",
       "      <td>2448</td>\n",
       "      <td>156898</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>orig_mime_types</th>\n",
       "      <td>object</td>\n",
       "      <td>2448</td>\n",
       "      <td>7</td>\n",
       "      <td>156898</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>resp_fuids</th>\n",
       "      <td>object</td>\n",
       "      <td>136587</td>\n",
       "      <td>136560</td>\n",
       "      <td>22759</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>resp_mime_types</th>\n",
       "      <td>object</td>\n",
       "      <td>136587</td>\n",
       "      <td>40</td>\n",
       "      <td>22759</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                  Data Type   Count Unique Values  Missing Values\n",
       "ts                  float64  159346        159336               0\n",
       "uid                  object  159346         67478               0\n",
       "id.orig_h            object  159346           128               0\n",
       "id.orig_p             int64  159346          1079               0\n",
       "id.resp_h            object  159346         11820               0\n",
       "id.resp_p             int64  159346            65               0\n",
       "trans_depth           int64  159346           186               0\n",
       "method               object  159277             6              69\n",
       "host                 object  157769         10969            1577\n",
       "uri                  object  159277         91578              69\n",
       "referrer             object  128257          9908           31089\n",
       "user_agent           object  158088           410            1258\n",
       "request_body_len      int64  159346           417               0\n",
       "response_body_len     int64  159346         31314               0\n",
       "status_code         float64  157452            26            1894\n",
       "status_msg           object  157452            65            1894\n",
       "info_code           float64      15             1          159331\n",
       "info_msg             object      15             1          159331\n",
       "filename            float64       0             0          159346\n",
       "tags                 object  159346             2               0\n",
       "username             object       2             1          159344\n",
       "password            float64       0             0          159346\n",
       "proxied              object       3             1          159343\n",
       "orig_fuids           object    2448          2448          156898\n",
       "orig_mime_types      object    2448             7          156898\n",
       "resp_fuids           object  136587        136560           22759\n",
       "resp_mime_types      object  136587            40           22759"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#DataFrame with columns\n",
    "columns = pd.DataFrame(list(df.columns.values[1:]))\n",
    "\n",
    "#DataFrame with data types\n",
    "data_types = pd.DataFrame(df.dtypes, columns=['Data Type'])\n",
    "\n",
    "#DataFrame with Count\n",
    "data_count = pd.DataFrame(df.count(), columns=['Count'])\n",
    "\n",
    "#DataFrame with unique values\n",
    "unique_value_counts = pd.DataFrame(columns=['Unique Values'])\n",
    "for v in list(df.columns.values):\n",
    "    unique_value_counts.loc[v] = [df[v].nunique()]\n",
    "\n",
    "missing_data_counts = pd.DataFrame(df.isnull().sum(), columns=['Missing Values'])\n",
    "data_quality_report = data_types.join(data_count).join(unique_value_counts).join(missing_data_counts)\n",
    "print('Data Quality Report')\n",
    "data_quality_report"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
